package cn.tedu.tnt_sky.controller.admin;

import cn.tedu.tnt_sky.common.result.Result;
import cn.tedu.tnt_sky.pojo.vo.ObtainLabelVO;
import cn.tedu.tnt_sky.pojo.vo.UserMoonVO;
import cn.tedu.tnt_sky.service.TagsService;
import cn.tedu.tnt_sky.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/tnt")
@Api(tags = "BE页面相关接口")
public class BEController {

    @Autowired
    private TagsService tagsService;

    @Autowired
    private UserService userService;

    @ApiOperation(value = "首页展示")
    @GetMapping("/index")
    public Result index(){
        log.info("首页展示");
        return Result.success();
    }

    @GetMapping("/obtainLabel")
    @ApiOperation(value = "获取标签数据")
    public Result<ObtainLabelVO> obtainLabel(){
        log.debug("获取首页页面标签数据");
        ObtainLabelVO label = tagsService.obtainLabel();
        return Result.success(label);
    }

    @GetMapping("/moon")
    @ApiOperation(value = "月份统计用户数量")
    public Result<UserMoonVO> moonNumberUser(){
        log.debug("获取月份统计用户数量");
        UserMoonVO userNumber = userService.moonNumberUser();
        return Result.success(userNumber);
    }
}
